<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>设置</title>

    <!-- Custom fonts for this template-->
    <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
    <link
            href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
            rel="stylesheet">

    <link rel="stylesheet" href="layui/css/layui.css">
    <!-- Custom styles for this template-->
    <link href="css/sb-admin-2.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/canvas.css">

    <!-- 重要的 Jquery 文件先导入 -->
    <script src="vendor/jquery/jquery.min.js"></script>

    <link rel="stylesheet" href="angularjs/pagination.css">
    <link rel="stylesheet" href="layer/layer/theme/default/layer.css">
    <script src="layer/layer/layer.js"></script>
    <script src="angularjs/angular.min.js"></script>
    <script src="angularjs/pagination.js"></script>
    <script src="bootstrap/js/jquery-cookie/jquery.cookie.js"></script>

    <script type="text/javascript" src="layui/layui.all.js"></script>


    <script>
        var cookie_user_id = $.cookie("stock_user_id");
        var app = angular.module("myApp", []);
        app.controller("settingCtrl", function ($scope, $http) {
            $scope.userid = $.cookie("stock_user_id");
            $scope.bankCardList = [];
            $scope.user = {};
            $scope.initFunction = function () {

                $.ajaxSettings.async = false;
                $.ajax({
                    url: "/users/user/sBankCard?userid=" + $scope.userid,
                    type: "GET",
                    contentType: "application/json;charset=UTF-8",
                    dataType: "json",
                    timeout: 10000,          // 设置超时时间
                    success: function (data) {
                        if (null == data.data || "null" == data.data) {
                            layer.msg("暂无数据", { icon: 2 });
                        } else {
                            $scope.bankCardList = data.data;
                        }
                    },
                    error: function (data) {
                        layer.msg("找不到网络资源", { icon: 2 });
                    }
                });

                $.ajax({
                    url: "/users/getUsrMsg?userid=" + $scope.userid,
                    type: "GET",
                    contentType: "application/json;charset=UTF-8",
                    dataType: "json",
                    timeout: 10000,          // 设置超时时间
                    success: function (data1) {
                        if (null == data1.data || "null" == data1.data) {
                            layer.msg("暂无数据", { icon: 2 });
                        } else {
                            $scope.user = data1.data;
                        }
                    },
                    error: function (data1) {
                        layer.msg("找不到网络资源", { icon: 2 });
                    }
                });
                $.ajaxSettings.async = true;

            };


            //修改验证用户输入的验证码是否是正确
            $scope.Amend = function (olduserpwd, newuserpwd, userpwd2) {

                var olduserpwd = document.getElementById('olduserpwd').value;
                var newuserpwd = document.getElementById('newuserpwd').value;
                var userupwd2 = document.getElementById('userupwd2').value;

                if (olduserpwd == "") {
                    layer.tips("请输入原密码", "#olduserpwd", { tips: [3, "blue"], time: 1500 });
                    return false;
                }
                if (newuserpwd == "") {
                    layer.tips("请输入新密码", "#newuserpwd", { tips: [3, "blue"], time: 1500 });
                    return false;
                }
                if (userupwd2 == "") {
                    layer.tips("请您再次确认密码", "#userupwd2", { tips: [3, "blue"], time: 1500 });
                    return false;
                }
                if (newuserpwd != userupwd2) {
                    //alert("两次密码不一致");
                    layer.msg("两次密码不一致,请重新输入!!!", { icon: 5 });
                    document.getElementById('userupwd2').value = null;
                    return false;
                }

                if (!(/^[0-9A-Za-z]{8,20}$/.test(newuserpwd))) {
                    //alert("请输入合法的8-20密码");
                    layer.msg("请输入合法的8-20密码", { icon: 5 });
                    document.getElementById('newuserpwd').value = null;
                    return false;
                }

                $scope.userid = cookie_user_id;
                $http.get("users/user/modification?userid=" + $scope.userid + "&olduserpwd=" + $scope.olduserpwd + "&newuserpwd=" + $scope.newuserpwd).success(function (data) {
                    if (data.code == 200) {
                        layer.msg("修改密码成功", {
                            time: 1000, icon: 6, end: function () {
                                window.location.href = "login.html";
                            }
                        });
                        return true;
                    } else {
                        layer.msg("修改密码失败!!!请检查原密码输入正确!", { time: 1000, icon: 5 });
                        return false;
                    }
                })
            }

            //删除uid的cookie
            $scope.delCookie = function () {
                $.removeCookie('stock_user_id',{ path: '/'});
                $.removeCookie("stock_user_role",{path:'/'});
            };

        });


    </script>
    <style>
        .btom {
            margin-bottom: 16px;
        }

        .card-body{
            padding: .59rem;
        }

        .fs{
            font-size: 18px;
        }
        .bl-primary{
            border-left: .55rem solid #4e73df;
        }
        .bl-success{
            border-left: .55rem solid  #1cc88a;
        }
        .bl-warning{
            border-left: .55rem solid #f6c23e;
        }
        .bl-info{
            border-left: .55rem solid #36b9cc;
        }
    </style>
</head>

<body id="page-top" ng-app="myApp" ng-controller="settingCtrl" ng-init="initFunction()">
<!-- 整体页面开始 -->
<div id="wrapper">

    <!-- 侧边栏开始 -->
    <ul class="navbar-nav bg-gray-800 sidebar sidebar-dark accordion" id="accordionSidebar">

        <!-- 公司logo与公司名区域 -->
        <a class="sidebar-brand d-flex align-items-center justify-content-center" href="index.html">
            <div class="sidebar-brand-icon rotate-n-15">
                <i class="fas fa-laugh-wink"></i>
            </div>
            <div class="sidebar-brand-text mx-3">金正股份<sup>TM</sup></div>
        </a>

        <!-- 分割线 -->
        <hr class="sidebar-divider my-0 bg-gray-800">

        <!-- 首页模块 -->
        <li class="nav-item active">
            <a class="nav-link" href="index.html">
                <i class="fas fa-fw fa-tachometer-alt"></i>
                <span>首页</span></a>
        </li>

        <!-- 分割线 -->
        <hr class="sidebar-divider bg-gray-800">

        <!-- 股票行情头标题 -->
        <div class="sidebar-heading">
            股票市场
        </div>

        <!-- 热门股票模块 -->
        <li class="nav-item">
            <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseTwo"
               aria-expanded="true" aria-controls="collapseTwo">

                <i class="fas fa-fire fa-cog"></i>

                <span>热门股票</span>
            </a>
  <!--          <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionSidebar">
                <div class="bg-white py-2 collapse-inner rounded">
                    <h6 class="collapse-header">Custom Components:</h6>
                    <a class="collapse-item" href="buttons.html">Buttons</a>
                    <a class="collapse-item" href="cards.html">Cards</a>
                </div>
            </div>-->
        </li>

        <!-- 股票行情模块 -->
        <li class="nav-item">
            <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseUtilities"
               aria-expanded="true" aria-controls="collapseUtilities">
                <i class="fas fa-fw fa-chart-area"></i>
                <span>股票行情</span>
            </a>
<!--            <div id="collapseUtilities" class="collapse" aria-labelledby="headingUtilities"
                 data-parent="#accordionSidebar">
                <div class="bg-white py-2 collapse-inner rounded">
                    <h6 class="collapse-header">Custom Utilities:</h6>
                    <a class="collapse-item" href="utilities-color.html">Colors</a>
                    <a class="collapse-item" href="utilities-border.html">Borders</a>
                    <a class="collapse-item" href="utilities-animation.html">Animations</a>
                    <a class="collapse-item" href="utilities-other.html">Other</a>
                </div>
            </div>-->
        </li>

        <!-- 分割线 -->
        <hr class="sidebar-divider bg-gray-800">

        <!-- 交易系统头标题 -->
        <div class="sidebar-heading">
            交易中心
        </div>

        <!-- 股票买入模块 -->

        <li class="nav-item">
            <a class="nav-link" href="buy.html">
                <i class="fas fa-dollar-sign fa-2x"></i>
                <span>股票买入</span></a>
        </li>

        <!-- 股票卖出模块 -->
        <li class="nav-item">
            <a class="nav-link" href="maichu.html">
                <i class="fas fa-outdent"></i>
                <span>股票卖出</span></a>
        </li>

        <!-- 股票撤销模块 -->
        <li class="nav-item">
            <a class="nav-link" href="chedan.html">
                <i class="fas fa-window-close fa-table"></i>
                <span>股票撤销</span></a>
        </li>
        <!-- 分割线 -->
        <hr class="sidebar-divider bg-gray-800">
        <!--用户中心模块-->
        <div class="sidebar-heading">
            用户中心
        </div>
        <!-- 个人股票模块 -->
        <li class="nav-item">
            <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapsePages"
               aria-expanded="true" aria-controls="collapsePages">
                <i class="fas fa-warehouse fa-folder"></i>
                <span>我的股票</span>
            </a>
            <div id="collapsePages" class="collapse" aria-labelledby="headingPages" data-parent="#accordionSidebar">
                <div class="bg-gray-200 py-2 collapse-inner rounded">
                    <h6 class="collapse-header" style="color:gray">股仓</h6>
                    <a class="collapse-item" href="pos.html"> <i class="fas fa-arrow-right"></i>持仓</a>
                    <a class="collapse-item" href="chengjiao.html"> <i class="fas fa-arrow-right"></i>成交</a>
                    <a class="collapse-item" href="weituo.html"> <i class="fas fa-arrow-right"></i>委托</a>
                </div>
            </div>
        </li>

        <!-- 个人中心模块 -->
        <li class="nav-item">
            <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#center" aria-expanded="true"
               aria-controls="center">
                <i class="fas fa-user-astronaut fa-folder"></i>
                <span>个人中心</span>
            </a>
            <div id="center" class="collapse" aria-labelledby="headingPages" data-parent="#accordionSidebar">
                <div class="bg-gray-200 py-2 collapse-inner rounded">
                    <a class="collapse-item" href="setting.html"> <i class="fas fa-user-cog">&nbsp;</i>设置</a>
                    <a class="collapse-item" href="wallet.html"> <i class="fas fa-wallet">&nbsp;</i>钱包</a>
                </div>
            </div>
        </li>

        <!-- Divider -->
        <hr class="sidebar-divider d-none d-md-block bg-gray-800">

        <!-- Sidebar Toggler (Sidebar) -->
        <div class="text-center d-none d-md-inline">
            <button class="rounded-circle border-0" id="sidebarToggle"></button>
        </div>

    </ul>
    <!-- 侧边栏结束 -->

    <!-- 右侧内容区域 -->
    <div id="content-wrapper" class="d-flex flex-column">

        <!-- 主要内容 -->
        <div id="content">

            <!-- 顶部框 -->
            <nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">

                <!-- Topbar Navbar -->
                <ul class="navbar-nav ml-auto">

                    <!-- Nav Item - Search Dropdown (Visible Only XS) -->
                    <li class="nav-item dropdown no-arrow d-sm-none">
                        <a class="nav-link dropdown-toggle" href="#" id="searchDropdown" role="button"
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <i class="fas fa-search fa-fw"></i>
                        </a>
                        <!-- Dropdown - Messages -->
                        <div class="dropdown-menu dropdown-menu-right p-3 shadow animated--grow-in"
                             aria-labelledby="searchDropdown">
                            <form class="form-inline mr-auto w-100 navbar-search">
                                <div class="input-group">
                                    <input type="text" class="form-control bg-light border-0 small"
                                           placeholder="Search for..." aria-label="Search"
                                           aria-describedby="basic-addon2">
                                    <div class="input-group-append">
                                        <button class="btn btn-primary" type="button">
                                            <i class="fas fa-search fa-sm"></i>
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </li>

                    <!-- 个人中心模块 -->
                    <li class="nav-item dropdown no-arrow">
                        <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button"
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <span class="mr-2 d-none d-lg-inline text-gray-600 small">{{user.username}}</span>
                            <img class="img-profile rounded-circle" src="img/headpic.jpg">
                        </a>
                        <!-- Dropdown - User Information -->
                        <div class="dropdown-menu dropdown-menu-right shadow animated--grow-in"
                             aria-labelledby="userDropdown">
                            <a class="dropdown-item" href="openAccount.html">
                                <i class="fas fa-cogs fa-sm fa-fw mr-2 text-gray-400"></i>
                                开户
                            </a>
                            <a class="dropdown-item" href="login.html">
                                <i class="fas fa-user-circle fa-sm fa-fw mr-2 text-gray-400"></i>
                                登录
                            </a>
                            <a class="dropdown-item" href="register.html">
                                <i class="fas fa-user-plus fa-sm fa-fw mr-2 text-gray-400"></i>
                                注册
                            </a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="#" data-toggle="modal" data-target="#logoutModal">
                                <i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
                                退出登录
                            </a>
                        </div>
                    </li>

                </ul>
            </nav>
            <!-- 顶部框结束 -->

            <!-- 页面内容开始 -->
            <div class="layui-tab container-fluid">


                <ul class="layui-tab-title">
                    <li class="layui-this">个人信息</li>
                    <li>修改密码</li>
                </ul>

                <!-- 标签页内容开始 -->
                <div class="layui-tab-content">
                    <!-- 第一个标签页---------第一个标签页------------第一个标签页 -->
                    <div class="layui-tab-item layui-show">
                        <!-- 头部标签区域 -->
                        <div class="text-center btom">
                            <h1 class="h4 text-gray-900 mb-2" style="color: green;font-weight: bolder">
                                个人信息</h1>
                        </div>

                        <div class="row fs">

                            <div class="col-xl-3 col-md-3"></div>

                            <div class="col-xl-6 col-md-6 mb-6 btom">
                                <div class="card bl-primary shadow h-100 py-2">
                                    <div class="card-body">
                                        <div class="row no-gutters align-items-center">
                                            <div class="col mr-2">
                                                <div
                                                        class=" font-weight-bold text-primary text-uppercase">
                                                    姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：{{user.username}}
                                                    <a href="AmendName.html" style="float: right;font-weight: normal">修改</a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-md-3"></div>
                        </div>
                        <div class="row fs">
                            <div class="col-xl-3 col-md-3"></div>
                            <!-- Earnings (Monthly) Card Example -->
                            <div class="col-xl-6 col-md-6 mb-6 btom">
                                <div class="card bl-success shadow h-100 py-2">
                                    <div class="card-body">
                                        <div class="row no-gutters align-items-center">
                                            <div class="col mr-2">
                                                <div
                                                        class=" font-weight-bold text-success text-uppercase" >
                                                    手&nbsp;&nbsp;机&nbsp;&nbsp;号：<span ng-bind="user.userphone"></span></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-md-3"></div>
                        </div>
                        <div class="row fs">
                            <div class="col-xl-3 col-md-3"></div>
                            <div class="col-xl-6 col-md-6 mb-6 btom">
                                <div class="card bl-warning shadow h-100 py-2">
                                    <div class="card-body">
                                        <div class="row no-gutters align-items-center">
                                            <div class="col mr-2">
                                                <div
                                                        class=" font-weight-bold text-warning text-uppercase">
                                                    身&nbsp;&nbsp;份&nbsp;&nbsp;证：{{user.usernumberid == "" || user.usernumberid ==null?"未开户":user.usernumberid}}
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-md-3"></div>
                        </div>
                        <div class="row fs" ng-repeat="c in bankCardList">
                            <div class="col-xl-3 col-md-3"></div>
                            <!-- Earnings (Monthly) Card Example -->
                            <div class="col-xl-6 col-md-6 mb-6 btom">
                                <div class="card bl-info shadow h-100 py-2">
                                    <div class="card-body">
                                        <div class="row no-gutters align-items-center">
                                            <div class="col mr-2">
                                                <div class=" font-weight-bold text-info text-uppercase">
                                                    银行卡号：{{c.bankCardnumber == ""||c.bankCardnumber ==null?"未开户":c.bankCardnumber}}
                                                    {{c.bankCardname == ""||c.bankCardname ==null?"":"(" + c.bankCardname + ")"}}</div>
                                                <div class="h5 mb-0 font-weight-bold text-gray-800 ng-cloak"><a
                                                        ng-bind="stockUpanddowns"></a>
                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-md-3"></div>
                        </div>
                        <div >
                            <hr>
                            <footer>
                                <div class="container text-center">
                                    <p>

                                    </p>
                                    <div class="divider sm-size"></div>
                                    <p>
                                        风险警告:近期网络安全事件频发，为了确保您的账户安全，请及时更新您的账户密码！！！
                                        <br>
                                        建议采取英文字母+数字+符号的形式来设置密码，尽量避免使用有规律的字符串作为密码，以确保您的账户和财产安全！！！
                                    </p>
                                </div>
                            </footer>
                        </div>

                    </div>
                    <!-- 第一个标签页结束 -->

                    <!-- 第二个标签页----------第二个标签页-----------第二个标签页 -->
                    <div class="layui-tab-item card-body p-2">
                        <!-- Nested Row within Card Body -->
                        <div class="row">
                            <div class="col-lg-3 d-none d-lg-block"></div>
                            <div class="col-lg-6">
                                <div class="p-4">
                                    <div class="text-center">
                                        <h1 class="h4 text-gray-900 mb-2" style="color: green;font-weight: bolder">
                                            修改密码</h1>
                                        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
                                    </div>
                                    <form class="user">
                                        <div class="form-group">
                                            <input class="form-control form-control-user" type="password"
                                                   id="olduserpwd" ng-model="olduserpwd" aria-describedby="emailHelp"
                                                   placeholder="请输入原密码">
                                        </div>
                                        <div class="form-group">
                                            <input class="form-control form-control-user" type="password"
                                                   id="newuserpwd" ng-model="newuserpwd" aria-describedby="emailHelp"
                                                   placeholder="请输入修改的8-20位密码(字母加数字)" onblur="checkPwd()">
                                        </div>
                                        <div class="form-group">
                                            <input class="form-control form-control-user" type="password"
                                                   id="userupwd2" ng-model="userupwd2" id="exampleInputEmail"
                                                   aria-describedby="emailHelp" placeholder="确认您修改的密码"
                                                   onblur="checkPwd2()">
                                        </div>
                                        <hr>
                                        <a href="#" class="btn btn-primary btn-user btn-block" ng-click="Amend()">
                                            修改密码
                                        </a>
                                    </form>

                                </div>
                            </div>
                            <div class="col-lg-3 d-none d-lg-block"></div>
                        </div>
                        <div id="ta">
                            <hr>
                            <footer>
                                <div class="container text-center">
                                    <p>

                                    </p>
                                    <div class="divider sm-size"></div>
                                    <p>
                                        风险警告:近期网络安全事件频发，为了确保您的账户安全，请及时更新您的账户密码！！！
                                        <br>
                                        建议采取英文字母+数字+符号的形式来设置密码，尽量避免使用有规律的字符串作为密码，以确保您的账户和财产安全！！！
                                    </p>
                                </div>
                            </footer>
                        </div>

                    </div>
                    <!-- 第二个标签页结束 -->

                </div>
                <!-- 标签页内容结束 -->

            </div>
            <!-- /.container-fluid -->

        </div>
        <!-- 主要内容结束 -->

        <!-- 页脚 -->
        <footer class="sticky-footer bg-white">
            <div class="container my-auto">
                <div class="copyright text-center my-auto">
                    <span>Copyright &copy; Your Website 2020</span>
                </div>
            </div>
        </footer>
        <!-- 页脚结束 -->

    </div>
    <!-- 右侧内容区域结束 -->

</div>
<!-- 整体页面结束 -->

<!-- 滚动到顶部按钮-->
<a class="scroll-to-top rounded" href="#page-top">
    <i class="fas fa-angle-up"></i>
</a>

<!-- 退出登录弹出 模态框区域 -->
<div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
     aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">系统消息</h5>
                <button class="close" type="button" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
            </div>
            <div class="modal-body">如果您已经准备好结束当前的会话，请选择下面的“确定”</div>
            <div class="modal-footer">
                <button class="btn btn-secondary" type="button" data-dismiss="modal">取消</button>
                <a class="btn btn-primary"  ng-click="delCookie()" href="login.html">确定</a>
            </div>
        </div>
    </div>
</div>

<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
<script src="js/sb-admin-2.min.js"></script>

</body>

</html>